package o;

import com.huawei.appgallery.productpurchase.api.ProductDetailBean;
import com.huawei.appgallery.productpurchase.impl.cache.DpsProductDetail;
import com.huawei.appgallery.productpurchase.impl.server.ProductDetailResBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import o.crh.b;

public class cru implements IServerCallBack {
    private ProductDetailBean ˏ;

    public cru(ProductDetailBean productDetailBean) {
        this.ˏ = productDetailBean;
    }

    public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        boolean z = true;
        ProductDetailResBean productDetailResBean = (ProductDetailResBean) responseBean;
        if (productDetailResBean.getResponseCode() == 0 && productDetailResBean.getRtnCode_() == 0) {
            ˋ(productDetailResBean);
            return;
        }
        crf.ˎ.ˏ("ProductDetailCallBack", "Fail to get the product information. Status=" + productDetailResBean.getRtnCode_());
        if (this.ˏ == null) {
            z = false;
        } else if (this.ˏ.ㆍ() != 1) {
            z = false;
        }
        cso.ˎ(productDetailResBean.getResponseCode(), productDetailResBean.getRtnCode_(), z);
    }

    private void ˋ(ProductDetailResBean productDetailResBean) {
        DpsProductDetail ˋ = productDetailResBean.ˋ();
        if (ˋ == null || this.ˏ == null) {
            cro.ˏ().ˏ(1);
            return;
        }
        csi.ˎ(b.ʽ, ˋ.ʼ());
        if (!cgy.ˎ(this.ˏ.ˊ())) {
            cro.ˏ().ॱ(this.ˏ, ˋ);
        } else if (ˋ.ʽ() > 0 || ˋ.ʽ() == -1) {
            switch (this.ˏ.ㆍ()) {
                case 0:
                    cro.ˏ().ˊ(ˋ);
                    return;
                case 1:
                    cro.ˏ().ˋ(ˋ);
                    return;
                case 2:
                    crf.ˎ.ˋ("ProductDetailCallBack", "The free product has been purchased.");
                    cro.ˏ().ˏ(6);
                    return;
                default:
                    cro.ˏ().ˏ(2);
                    return;
            }
        } else {
            crf.ˎ.ˋ("ProductDetailCallBack", "No Remain.");
            cro.ˏ().ˏ(4);
        }
    }
}
